<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/jsp/admin/includes/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>用户积分列表</title>
		<%@ include file="/WEB-INF/view/jsp/admin/includes/meta.jsp"%>
		<link type="text/css" rel="stylesheet" href="${ctx}/admin/css/admin.css" />
		<link href="${ctx}/widgets/extremecomponents/extremecomponents.css"
			type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
	</head>
	<body>
		<div class="container">
			<h3>
				用户积分列表
			</h3>
			<!-- start user list -->
			<form action="${ctx}/admin/credit!list.do" method="post">
				用户名：<input type="text" id="username" name="username" value="${username }"/>&nbsp;&nbsp;
				Email:<input type="text" id="email" name="email"  value="${email }"/>&nbsp;&nbsp;
				火秀号:<input type="text" id="huoshowId" name="huoshowId" value="${huoshowId }"/>&nbsp;&nbsp;
				<input type="submit" value="查询" />&nbsp;&nbsp;
				<input type="button" onclick="resetPara();" value="清空查询条件"/>
			</form>
			<c:set var="tag" value="0" />
			<ec:table items="page.result" var="user" rowsDisplayed="10"
				autoIncludeParameters="true" retrieveRowsCallback="limit"
				action="${ctx}/admin/credit!list.do">
				<ec:row highlightRow="true">
					<ec:column property="rowcount" cell="rowCount" sortable="false"
						title="序号" width="30" />
					<ec:column property="username" title="用户名" sortable="true" />
					<ec:column property="nickName" title="昵称" />
					<c:forEach items="${creditTypeList}" var="creditType">
						<ec:column property="null" title="${creditType.title}" width="60"
							sortable="true">
							<c:forEach items="${userCreditMap}" var="map">
								<c:if test="${map.key==user.username}">
									<span id="defaultCredit${tag}">0</span>
									<c:if test="${not empty map.value}">
										<c:forEach items="${map.value}" var="credit">
											<c:if test="${credit.creditType.title == creditType.title}">
												<script language="javascript">$("#defaultCredit${tag}").html("");</script>${credit.amount}</c:if>
										</c:forEach>
									</c:if>
								</c:if>
							</c:forEach>
						</ec:column>
						<c:set var="tag" value="${tag+1}" />
					</c:forEach>

					<ec:column property="null" title="总积分" width="60" sortable="true">
						<c:set var="count" value="0"></c:set>
						<c:forEach items="${userCountMap}" var="map">
							<c:if test="${map.key==user.username}">
								<c:set var="count" value="${count+map.value}"></c:set>
							</c:if>
						</c:forEach>

						${count }
					</ec:column>

				</ec:row>
			</ec:table>

		</div>
	</body>
</html>
<script>
	function resetPara(){
		//alert($("#username").val());
		$("#username").val("");
		$("#email").val("");
		$("#huoshowId").val("");
		$("#username").focus();
	}
</script>